# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1DocumentInfo do
  @moduledoc """
  Detailed document information associated with a user event.

  ## Attributes

  *   `conversionValue` (*type:* `number()`, *default:* `nil`) - Optional. The conversion value associated with this Document. Must be set if UserEvent.event_type is "conversion". For example, a value of 1000 signifies that 1000 seconds were spent viewing a Document for the `watch` conversion type.
  *   `id` (*type:* `String.t`, *default:* `nil`) - The Document resource ID.
  *   `joined` (*type:* `boolean()`, *default:* `nil`) - Output only. Whether the referenced Document can be found in the data store.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The Document resource full name, of the form: `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/branches/{branch_id}/documents/{document_id}`
  *   `promotionIds` (*type:* `list(String.t)`, *default:* `nil`) - The promotion IDs associated with this Document. Currently, this field is restricted to at most one ID.
  *   `quantity` (*type:* `integer()`, *default:* `nil`) - Quantity of the Document associated with the user event. Defaults to 1. For example, this field is 2 if two quantities of the same Document are involved in a `add-to-cart` event. Required for events of the following event types: * `add-to-cart` * `purchase`
  *   `uri` (*type:* `String.t`, *default:* `nil`) - The Document URI - only allowed for website data stores.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :conversionValue => number() | nil,
          :id => String.t() | nil,
          :joined => boolean() | nil,
          :name => String.t() | nil,
          :promotionIds => list(String.t()) | nil,
          :quantity => integer() | nil,
          :uri => String.t() | nil
        }

  field(:conversionValue)
  field(:id)
  field(:joined)
  field(:name)
  field(:promotionIds, type: :list)
  field(:quantity)
  field(:uri)
end

defimpl Poison.Decoder,
  for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1DocumentInfo do
  def decode(value, options) do
    GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1DocumentInfo.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1DocumentInfo do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
